package com.bootssm.service.impl;

import com.bootssm.dao.StudentMapper;
import com.bootssm.entity.Student;
import com.bootssm.entity.StudentVO;
import com.bootssm.service.StudentService;
import com.bootssm.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMapper;
    @Autowired
    IdWorker idWorker;

    @Override
    public List<Student> findAll(StudentVO studentVO) {
        return studentMapper.findAll(studentVO);
    }

    @Override
    public void deleteById(String id) {
        studentMapper.deleteById(id);
    }

    @Override
    public void update(Student student) {
        studentMapper.update(student);
    }

    @Override
    public void save(Student student) {

        student.setId(idWorker.nextId()+"");

        studentMapper.save(student);
    }
    @Override
    public Integer getCount(StudentVO studentVO) {
        return studentMapper.getCount(studentVO);
    }
}
